package com.usian.wemedia.controller.v1;

import com.usian.api.wemedia.WmUserControllerApi;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.media.pojos.WmUser;
import com.usian.wemedia.service.WmUserServcie;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/user")
public class WmUserController implements WmUserControllerApi {
    @Autowired
    private WmUserServcie wmUserServcie;
    @Override
    @RequestMapping("/save")
    public ResponseResult inster(@RequestBody WmUser wmUser) {
        return wmUserServcie.inster(wmUser);
    }

    @Override
    @RequestMapping("/findByName/{name}")
    public WmUser findByName(@PathVariable("name") String name) {
        return wmUserServcie.findByName(name);
    }

    @Override
    @RequestMapping("/findOne/{id}")
    public WmUser findWmUserById(@PathVariable("id") Long id) {
        return wmUserServcie.getById(id);
    }
}
